home *** CD-ROM | disk | FTP | other *** search
/ Just Call Me Internet / Just Call Me Internet.iso / prog / atari / c / stngpasm / pure_c / include / uran / uran_sim.sh < prev    next >
Encoding:
Text File  |  1997-08-08  |  4.6 KB  |  232 lines

  1. ;----------------------------------------------------------------------------
  2. ;File name:    URAn_SIM.SH        Revision date:    1997.08.08
  3. ;Creator:    Ulf Ronald Andersson    Creation date:    1992.11.30
  4. ;(c)1992 by:    Ulf Ronald Andersson    All rights reserved
  5. ;Released as:    FREEWARE        (NB: commercial sales forbidden!)
  6. ;----------------------------------------------------------------------------
  7. ;Purpose:    Macro library for GEM function simulation in TOS programs
  8. ;----------------------------------------------------------------------------
  9. ;    Library macros:
  10. ;sim_aes    func,arg,arg,arg...
  11. ;
  12. ;NB:    Use "make SIM_links" to include all referred code.
  13. ;    This replaces "make GEM_links" normally used with URAn_GEM.S .
  14. ;----------------------------------------------------------------------------
  15. ;Required header declarations:
  16. ;
  17. ;    include    "uran\STRUCT.SH"
  18. ;    include    "uran\URAn_SYS.SH"
  19. ;    include    "uran\URAn_DOS.SH"
  20. ;    include    "uran\URAn_GEM.SH"
  21. ;    include    "uran\URAn_SIM.SH"
  22. ;
  23. ;----------------------------------------------------------------------------
  24. ;Remarks:
  25. ;
  26. ;Required variables:
  27. ;
  28. ;progtype    .L indicates program type:
  29. ;  ...            $0000.$FFFF == TOS/TTP/boot_PRG
  30. ;  ...            $0000.ap_id == APP/GTP/non_boot_PRG
  31. ;  ...            $FFFF.ap_id == ACC
  32. ;
  33. ;NB:    This will be defined by including URAn_APP.S
  34. ;
  35. ;----------------------------------------------------------------------------
  36. ;
  37.     _unidec    sim_aes
  38.     _unidec    sim_evnt_keybd
  39.     _unidec    sim_form_alert
  40. ;
  41. ;----------------------------------------------------------------------------
  42. ;
  43.     .macro    SIM_links
  44.     _unidef    sim_aes,sim_evnt_keybd,sim_form_alert
  45.     GEM_links
  46.     .endm    ;SIM_links
  47. ;
  48. ;
  49.     .macro    sim_aes    op,v2,v3,v4,v5,v6,v7,v8,v9,va
  50.     _uniref    sub_aes
  51.     _uniref    sim_aes
  52.     _uniref    sim_&op
  53.     __inaes    op,v2,v3,v4,v5,v6,v7,v8,v9,va
  54.     pea    code_sim_&op
  55.     move.l    #op,d0
  56.     bsr    code_sim_aes
  57.     .endm    ;sim_aes
  58. ;
  59. ;
  60.     .macro    code_sim_aes
  61.     movem.l    (sp)+,d1/a0
  62.     move.l    d1,-(sp)
  63.     tst    progtype+2
  64.     bpl    code_sub_aes
  65.     jsr    (a0)
  66.     move.l    intout,d0
  67.     swap    d0
  68.     move.l    addrout,d1
  69.     rts
  70.     .endm    ;code_sim_aes
  71. ;
  72. ;
  73.     .macro    code_sim_evnt_keybd
  74.     gemdos    Crawcin
  75.     lsl    #8,d0
  76.     lsr.l    #8,d0
  77.     move    d0,intout
  78.     rts
  79.     .endm    ;code_sim_evnt_keybd
  80. ;
  81. ;
  82.     .macro    code_sim_form_alert
  83.     movem.l    d2-d5/a1/a3,-(sp)
  84.     clr    d3
  85.     gemdos    Cconws,.begform_s(pc)
  86.     move.l    addrin,a3
  87.     move.b    (a3)+,d0
  88.     beq    .done_disp
  89.     move.b    (a3)+,d0
  90.     beq    .done_disp
  91.     ext    d0
  92.     sub    #'0',d0
  93.     cmp    #3,d0
  94.     bhi.s    .no_head
  95.     add    d0,d0
  96.     add    d0,d0
  97.     move.l    .hs_tb(pc,d0),d0
  98.     move    #'  ',d1
  99.     lea    .textbuff,a0
  100.     move    d1,(a0)+
  101.     move.l    d0,(a0)+
  102.     move    d1,(a0)+
  103.     bra.s    .loop_1
  104. ;
  105. .hs_tb:
  106. .hs0_s:    dc.l    '    '
  107. .hs1_s:    dc.l    '!!!!'
  108. .hs2_s:    dc.l    '????'
  109. .hs3_s:    dc.l    'STOP'
  110. ;
  111. .loop_1:
  112.     move.b    (a3)+,d0
  113.     beq.s    .done_disp
  114. .no_head:
  115.     cmp.b    #'[',d0
  116.     bne.s    .loop_1
  117. .loop_2:
  118.     st    d4
  119.     lea    .textbuff+8(pc),a0
  120.     moveq    #30-1,d5
  121. .loop_3:
  122.     move.b    (a3)+,d0
  123.     move.b    d0,(a0)+
  124.     beq.s    .end_lines
  125.     cmp.b    #']',d0
  126.     beq.s    .end_lines
  127.     cmp.b    #'|',d0
  128.     dbeq    d5,.loop_3
  129.     beq.s    .end_lines
  130.     clr    d4
  131. .end_lines:
  132.     clr.b    -1(a0)
  133.     bsr    .disptext
  134.     subq    #1,a3
  135.     tst    d4
  136.     beq.s    .loop_2
  137.     move.b    (a3)+,d0
  138.     beq.s    .done_disp
  139.     cmp.b    #']',d0
  140.     bne.s    .loop_2
  141. .loop_4:
  142.     move.b    (a3)+,d0
  143.     beq.s    .done_disp
  144.     cmp.b    #'[',d0
  145.     bne.s    .loop_4
  146.     addq    #1,a3
  147. .done_disp:
  148.     subq    #1,a3
  149.     bsr    .crlf_sub
  150.     lea    .textbuff+2(pc),a0
  151. .loop_5:
  152.     addq    #1,d3
  153.     move    d3,d4
  154.     add    #'0',d4
  155.     move.b    d4,(a0)+
  156.     move.b    #'<',d4
  157.     cmp    intin,d3
  158.     bne.s    .non_def_1
  159.     move.b    #'[',d4
  160. .non_def_1:
  161.     move.b    d4,(a0)+
  162.     moveq    #10-1,d5
  163. .loop_6:
  164.     move.b    (a3)+,d0
  165.     move.b    d0,(a0)+
  166.     beq.s    .end_butts
  167.     cmp.b    #']',d0
  168.     beq.s    .end_butts
  169.     cmp.b    #'|',d0
  170.     dbeq    d5,.loop_6
  171.     beq.s    .end_butts
  172. .loop_7:
  173.     move.b    (a3)+,d0
  174.     beq.s    .end_butts
  175.     cmp.b    #']',d0
  176.     beq.s    .end_butts
  177.     cmp.b    #'|',d0
  178.     bne.s    .loop_7
  179. .end_butts:
  180.     addq.b    #2,d4
  181.     move.b    d4,-1(a0)
  182.     move.b    #' ',(a0)+
  183.     cmp    #3,d3
  184.     bhs.s    .done_butts
  185.     subq    #1,a3
  186.     move.b    (a3)+,d0
  187.     beq.s    .done_butts
  188.     cmp.b    #']',d0
  189.     bne.s    .loop_5
  190. .done_butts:
  191.     clr.b    -1(a0)
  192.     bsr    .disptext
  193.     gemdos    Cconws,.endform_s(pc)
  194. .wait_key:
  195.     gemdos    Crawcin
  196.     ext    d0
  197.     cmp    #CR,d0
  198.     bne.s    .non_def_2
  199.     move    intin,d0
  200.     bne.s    .done_keys
  201. .non_def_2:
  202.     sub    #'0',d0
  203.     ble.s    .wait_key
  204.     cmp    d3,d0
  205.     bhi.s    .wait_key
  206. .done_keys:
  207.     move    d0,intout
  208.     movem.l    (sp)+,d2-d5/a1/a3
  209.     rts
  210. ;
  211. .disptext:
  212.     gemdos    Cconws,.textbuff(pc)
  213. .crlf_sub:
  214.     gemdos    Cconws,.crlf_s(pc)
  215.     move.l    .hs0_s(pc),.textbuff+2
  216.     rts
  217. ;
  218. .textbuff:    dc.b    '  !!!!  '
  219.         ds.b    40
  220. .begform_s:    dc.b    ESC,'E',LF,LF,LF,ESC,'j',NUL
  221. .endform_s:    dc.b    ESC,'k',NUL
  222. .crlf_s:    dc.b    CR,LF,NUL
  223. ;
  224.     even
  225. ;
  226.     endm    ;code_sim_form_alert
  227. ;
  228. ;
  229. ;----------------------------------------------------------------------------
  230. ;    End of file:    URAn_SIM.SH
  231. ;----------------------------------------------------------------------------
  232.